<?php

/*

COMP 353F
Dr. B Desai
Final Project
Group #11

6330746 Nicholas CONSTANTINIDIS
9532862 Jacqueline FU
5484537 Claudio Javier LOPEZ FLORES
9218416 Que Tung NGUYEN

*/

class Connect
{
	public function __construct()
	{
		$host = "clipper.encs.concordia.ca";
		$username  = "dtc353_2";
		$password = "tkN5KY";
		$database = "dtc353_2";
		
		if(!($connection = mysql_connect($host,$username,$password)))
			die('Can not connect to db');
		mysql_select_db($database,$connection);
	}

	public function to_array($sql_result)
	{
		$rows = array();
		$i=0;
		while($rows[] = mysql_fetch_array($sql_result,MYSQL_ASSOC))
		{
			$i++;
		}
		array_pop($rows);
		return $rows;
	}

	public function query($sql_text)
        {

                $result= mysql_query($sql_text);

                if (!$result)
                {
                        return false;
                }
                return  $result;
        }

}

?>
